import {reqHotMovieList,reqComingMovieList} from '@/api'

const actions = {
    async getHotMovieList({commit}){
        const result = await reqHotMovieList()
        // console.log(result);
        commit('SAVE_HOT_MOVIE_LIST',result.movieList)
        commit('SAVE_HOT_MOVIE_IDS',result.movieIds)
    },
    async getComingMovieList({commit}){
        const data={
            limit: 10,
            optimus_uuid: 'B52C96001E4B11EA928853AC6CFDBC0221750D6FF9374A35B50A070B3195ED15',
            optimus_risk_level: 71,
            optimus_code: 10,
            token: ''
          }
        const result = await reqComingMovieList(data)
        console.log(result);
        commit('SAVE_COMING_MOVIE_LIST',result.coming)
    },
    // async getMoreHotMovieList({commit},state){
    //     console.log(state);
    //     // const result = await reqHotMovieList()
    //     // // console.log(result);
    //     // commit('SAVE_HOT_MOVIE_LIST',result.movieList)
    //     // commit('SAVE_HOT_MOVIE_IDS',result.movieIds)
    // },
}
const mutations = {
    SAVE_HOT_MOVIE_LIST(state,list){
        state.hotMovieList =list
    },
    SAVE_HOT_MOVIE_IDS(state,list){
        state.hotMovieIds = list
    },
    SAVE_COMING_MOVIE_LIST(state,list){
        state.comingMovieList = list
    }
}
const state = {
    hotMovieList:[],
    hotMovieIds:[],
    comingMovieList:[]
}
const getters = {

}
export default {
    namespaced:true,
    actions,
    mutations,
    state,
    getters,
}